<template>
  <van-dialog
    @confirm="submit"
    v-model="show"
    title="意见反馈"
    show-cancel-button
  >
    <van-field
      v-model.trim="message"
      rows="2"
      autosize
      type="textarea"
      maxlength="50"
      placeholder="请填写反馈"
      show-word-limit
    />
  </van-dialog>
</template>
<script>
import { questionsComment } from '@/api/question.js'
export default {
  name: 'CommentDialog',
  data () {
    return {
      show: false,
      message: '',
      question: ''
    }
  },
  methods: {
    async submit () {
      if (this.message !== '') {
        const res = await questionsComment({
          content: this.message,
          question: this.question
        })
        if (res.message === 'success') {
          this.$toast.success('已收到您的反馈')
        }
      }
    }
  }
}
</script>
<style scoped lang="scss"></style>
